<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>商品信清单</title>
<link href="resource/css/cxCalendar.css" rel="stylesheet" type="text/css"/>
<link href="resource/css/list.css" rel="stylesheet" type="text/css"/>
<script src="resource/js/common/jquery-1.8.3.js"></script>
<script src="resource/js/common/cxCalendar.js"></script>
<script src="resource/js/common/dateTime.js"></script>
</head>
<body>
<s:debug/>
	<h1>${login }</h1>
	<a href="upload.jsp">上传</a>
	<div id="content">
		<!-- 条件查询区域 -->
		<form action="selectAction?place=select" method="post">
			<table>
				<tr>
					<th>商品名称</th>
					<td><input type="text" name="goodsCondition.name" value="${goodsCondition.name }" /></td>
				</tr>
				<tr>
					<th>生产日期开始时间</th>
					<td><input type="text" name="goodsCondition.beginDate" class="dateTime" value="<s:date name="goodsCondition.beginDate"   format="yyyy-MM-dd HH:dd:ss" />"/></td>
				</tr>
				<tr>
					<th>生产日期结束时间</th>
					<td><input type="text" name="goodsCondition.endDate" class="dateTime" value="<s:date name="goodsCondition.endDate"   format="yyyy-MM-dd HH:dd:ss" />" /></td>
				</tr>
				<tr>
					<th>商品类型</th>
					<td>
						<select name="goodsCondition.goodsTypeId" >
							<option value="0">所有类型</option>
							
							<c:forEach items="${goodsTypeList }" var="goodsType">
								<option value="${goodsType.id }"
									<c:if test="${goodsType.id == goodsCondition.goodsTypeId }">
										selected="selected"
									</c:if>
								>${goodsType.name }</option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2">
					<input type="submit" value="查询" /></td>
				</tr>
			</table>
		</form>

		<!-- 信息展示区域 -->
		<table>
			<tr>
				<th>编号</th>
				<th>商品名称</th>
				<th>生产日期</th>
				<th>商品类型名称</th>
				<th>商品产地</th>
			</tr>
			<c:if test="${empty goodsList }">
				<tr>
					<td colspan="5">没有查询到信息</td>
				</tr>
			</c:if>
			<c:forEach items="${goodsList }" var="goods" varStatus="status">
				<tr <c:if test="${status.index % 2 == 0 }">class="color"</c:if>>
					<td>${goods.id }</td>
					<td>${goods.name }</td>
					<td>${goods.createDate }</td>
					<td>${goods.goodsType.name }</td>
					<td>${goods.address }</td>
				</tr>
			</c:forEach>
		</table>
		<c:if test="${goodsCondition.maxPageNum >= 2 }">
			<div class="page"><p>共${goodsCondition.maxPageNum }页&nbsp;&nbsp;&nbsp;现在是第${goodsCondition.pageIndex }页
									</p>
				<a href="selectAction.action?goodsCondition.pageIndex=1">首页</a> <a
					href="selectAction.action?goodsCondition.pageIndex=${goodsCondition.pageIndex - 1}">上一页</a>
				<form action="selectAction.action" method="post">
					<input type="text"
						name="goodsCondition.pageIndex" size="1" /><input type="submit" value="GO" />
				</form>
				<a href="selectAction.action?goodsCondition.pageIndex=${goodsCondition.pageIndex + 1}">下一页</a>
				<a href="selectAction.action?goodsCondition.pageIndex=${goodsCondition.maxPageNum }">末页</a>
			</div>
		</c:if>
	</div>
</body>
</html>